/**
 * Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef GE_COMMON_PRELOAD_TASK_INFO_PRE_TASK_STATUS_H_
#define GE_COMMON_PRELOAD_TASK_INFO_PRE_TASK_STATUS_H_
#include "graph/types.h"
#include "common/checker.h"

namespace ge {
ge::char_t *CreateMessage(const ge::char_t * const format, va_list arg);
class PreTaskStatus {
 public:
  bool IsSuccess() const {
    return status_ == nullptr;
  }
  const char_t *GetErrorMessage() const noexcept {
    return status_;
  }
  PreTaskStatus() = default;
  ~PreTaskStatus() {
    delete[] status_;
  }
  PreTaskStatus(const PreTaskStatus &other);
  PreTaskStatus(PreTaskStatus &&other) noexcept;
  PreTaskStatus &operator=(const PreTaskStatus &other);
  PreTaskStatus &operator=(PreTaskStatus &&other) noexcept;

  static PreTaskStatus Success();
  static PreTaskStatus ErrorStatus(const char_t *message, ...);
 private:
  char_t *status_ = nullptr;
};
}  // namespace ge
#endif  // GE_COMMON_PRELOAD_TASK_INFO_PRE_TASK_STATUS_H_